Page({



    data: {
        initImage : '',
    },

    onLoad(){
        wx.getImageInfo({
            src: 'http://dev.thinkphp.com//uploads/init.jpg',
            success: (result)=>{
                console.log(result);
                this.setData({
                    initImage : result.path,
                })
            },
            fail: ()=>{},
            complete: ()=>{}
        });
    },

    uploadFile(){
        var upTask = wx.uploadFile({
            url: 'http://dev.thinkphp.com//index/upload/uploadFile',
            filePath: this.data.initImage,
            name: 'file',
            formData: {
                'fileId': '1'
            },
            success: (result)=>{
                console.log(result);
            },
            fail: ()=>{console.log('fail');},
            complete: ()=>{console.log('complete');}
        });
    }
})